namespace hjc {

	export class AStarPath {

		public cost: number;		//路径总耗费
		public start: AStarNode;	//路径起点
		public goal: AStarNode;		//路径终点
		public nodes: AStarNode[];	//路径点
		public step: number;		//路径总步数
		public map: AStarMap;
		public constructor(goal: AStarNode, map: AStarMap, direct: boolean = false) {
			this.goal = goal;
			this.map = map;
			this.nodes = [this.goal];
			if (direct) {
				this.step = 1;
				this.start = goal;
			} else {
				this.step = 0;
				let node = this.goal;
				while (!!node.former) {
					node = node.former;
					this.nodes.push(node);
					this.step++;
				}
				this.start = this.nodes.tail();
				this.nodes.reverse();
			}
		}
	}
}